﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace QuickModel.DoorAndWindow
{
	public class ComparerDoorAndWindowConfigInfo : IComparer<DoorAndWindowConfigInfo>
	{
		public int Compare(DoorAndWindowConfigInfo x, DoorAndWindowConfigInfo y)
		{
			bool flag = x == y;
			int result;
			if (flag)
			{
				result = 0;
			}
			else
			{
				bool flag2 = x.EnumCategory < y.EnumCategory;
				if (flag2)
				{
					result = -1;
				}
				else
				{
					bool flag3 = x.EnumCategory > y.EnumCategory;
					if (flag3)
					{
						result = 1;
					}
					else
					{
						bool flag4 = x.CanAnalyseNo && !y.CanAnalyseNo;
						if (flag4)
						{
							result = -1;
						}
						else
						{
							bool flag5 = !x.CanAnalyseNo && y.CanAnalyseNo;
							if (flag5)
							{
								result = 1;
							}
							else
							{
								bool flag6 = !x.No.IsEmpty<char>() && y.No.IsEmpty<char>();
								if (flag6)
								{
									result = -1;
								}
								else
								{
									bool flag7 = x.No.IsEmpty<char>() && !y.No.IsEmpty<char>();
									if (flag7)
									{
										result = 1;
									}
									else
									{
										bool flag8 = !x.No.IsEmpty<char>() && !y.No.IsEmpty<char>();
										if (flag8)
										{
											bool flag9 = x.No.CompareTo(y.No) < 0;
											if (flag9)
											{
												return -1;
											}
											bool flag10 = x.No.CompareTo(y.No) > 0;
											if (flag10)
											{
												return 1;
											}
										}
										bool flag11 = (int)x.Width > (int)y.Width;
										if (flag11)
										{
											result = -1;
										}
										else
										{
											bool flag12 = (int)x.Width < (int)y.Width;
											if (flag12)
											{
												result = 1;
											}
											else
											{
												bool flag13 = (int)x.Height > (int)y.Height;
												if (flag13)
												{
													result = -1;
												}
												else
												{
													bool flag14 = (int)x.Height < (int)y.Height;
													if (flag14)
													{
														result = 1;
													}
													else
													{
														result = 0;
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
			return result;
		}
	}
}
